<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="msg"><button onclick="send_msg()">发送消息</button>
<div id="chat_list" style="width: 500px; height: 500px"></div>
<script type="application/javascript">
    var ws = new WebSocket("ws://127.0.0.1:9527/qun");
    // ws.onopen = function () {
    //   console.log("123")
    // };
    // ws.onmessage= function (data) {
    //     console.log(data.data);
    //     var ptag = document.createElement("p");
    //     ptag.innerText = data.data;
    //     document.getElementById("chat_list").appendChild(ptag);
    // };
    // ws.onclose = function () {
    //     window.location.reload()
    // };
    
    function send_msg() {
        msg = document.getElementById("msg").value;
        ws.send(msg);
    }
</script>

</body>
</html>